
package com.example.demo.mapper;

import com.example.demo.controller.vo.CourseDetailVO;
import com.example.demo.entity.CoursePO;
import com.example.demo.entity.OrderPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface CourserMapper {

    @Select("select * from tb_course where id = #{id} ")
    CoursePO selectCourseDetail(long id);

//    @Select("select * from tb_course where userId = #{id} ")
//    List<CoursePO> selectCourseListByUserId(String id);

    @Select("select * from tb_course")
    List<CoursePO> selectCourseList();

    @Update("update tb_course set  readySum = #{readySum} and saleNums = #{saleNums} where id = #{id} ")
    void updateCourseByCourseId(CoursePO coursePO);

    //@Select("select * from tb_course like '%' + #{title} + '%'")

    @Select("select * from tb_course where title = #{title}")
    List<CoursePO> selectCourseListByTitle(String title);

//    @Select("select * from tb_course where type = #{type} and title = #{title}")
//    List<CoursePO> selectCourseListByTitle(int type,String title);

//+++++++++++++++++++++++++++
    @Select("select * from tb_course where id = #{courseId} ")
    CoursePO selectCourseByCourseId(long courseId);
}
